package com.xingongchang.baolebei.activity;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import com.insthub.BeeFramework.activity.BaseActivity;
import com.umeng.analytics.MobclickAgent;
import com.xingongchang.baolebei.R;
import com.xingongchang.baolebei.adapter.GalleryImageAdapter;

public class GalleryImageActivity extends BaseActivity {

	private ViewPager imagePager;
	private GalleryImageAdapter guideImageAdapter;
	private SharedPreferences shared;
	private SharedPreferences.Editor editor;
	int backgoundWidth;
	int total_page;
	DisplayMetrics dm;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.gallery_image);
		dm = new DisplayMetrics();
		// 取得窗口属性
		this.getWindowManager().getDefaultDisplay().getMetrics(dm);
		shared = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
		editor = shared.edit();

		boolean isFirstRun = shared.getBoolean("isFirstRun", true);
		if (!isFirstRun) {
			Intent it = new Intent(this, BaolebeiActivity.class);
			startActivity(it);
			finish();
		}

		imagePager = (ViewPager) findViewById(R.id.image_pager);

		guideImageAdapter = new GalleryImageAdapter(GalleryImageActivity.this);
		imagePager.setAdapter(guideImageAdapter);

	}



	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		MobclickAgent.onPause(this);
	}

}
